#ifndef WF_DRAWLINERELANGLE_H
#define WF_DRAWLINERELANGLE_H

#include "pf_previewactioninterface.h"
#include "gui_export.h"

/**
 * This action class can handle user events to draw lines with a given angle
 * to a given entity.
 *
 */
class GUI_EXPORT WF_DrawLineRelAngle : public PF_PreviewActionInterface {
	Q_OBJECT
private:
    enum Status {
        SetEntity,     /**< Choose entity. */
        SetPos,        /**< Choose position. */
		SetAngle,      /**< Set angle in console. */
		SetLength      /**< Set length in console. */
    };

public:
    WF_DrawLineRelAngle(PF_Container& container,
                              PF_GraphicView& graphicView,
                              double angle=0.0,
                              bool fixedAngle=false);
    ~WF_DrawLineRelAngle() {}
	
	static QAction* createGUIAction(LX_Define::ActionType /*type*/, QObject* /*parent*/);
	
	virtual LX_Define::ActionType rtti() {
		return LX_Define::ActionDrawLineRelAngle;
	}

    virtual void trigger();

    virtual void mouseMoveEvent(PF_MouseEvent* e);
    virtual void mouseReleaseEvent(PF_MouseEvent* e);
	
	virtual void coordinateEvent(PF_CoordinateEvent* e);
    virtual void commandEvent(PF_CommandEvent* e);
	virtual PF_StringList getAvailableCommands();
	
    virtual void hideOptions();
    virtual void showOptions();
	
    virtual void updateMouseButtonHints();
    virtual void updateMouseCursor();
    virtual void updateToolBar();
	
	void setAngle(double a) {
		angle = a;
	}

	double getAngle() {
		return angle;
	}

	void setLength(double l) {
		length = l;
	}

	double getLength() {
		return length;
	}

	bool hasFixedAngle() {
		return fixedAngle;
	}

private:
    /** new line */
    //PF_Line* line;
    /** Chosen entity */
    PF_Entity* entity;
    /** Chosen position */
    PF_Vector pos;
    /** Data of new line */
    PF_LineAttribute data;
    /**
     * Line angle.
     */
    double angle;
    /**
     * Line length.
     */
    double length;
    /**
     * Is the angle fixed?
     */
    bool fixedAngle;
};

#endif
